;
;  ----------------------------
;  Gmail Checker by FiberOPtics
;  ----------------------------
; 
; Author:    FiberOPtics @ mirc.fiberoptics@gmail.com
;
; Usage:     /checkgmail <email> [N]
;        
;            If you specify the N parameter, it will only echo the first N unread mails.
;
;
;            You can also check unread emails through the popup interface which can be found in 
;            the menubar/status/channel/query windows. 
;
;
; Install:   Save the folder "Gmail Checker" to your main mIRC folder, and in mIRC type:
;               
;            //.load -rs " $+ $mircdirgmail checker\checkgmail.mrc"
;
;
; Uninstall: You can uninstall this addon through the "Gmail Checker" popup which you
;            can access through the menubar/status/channel/query windows, or by typing
;
;            //.unload -rs checkgmail.mrc in mIRC.
;
;
; Purpose:   Will echo unread emails from the account's inbox to your active window in the form of:
;
;            #N
;            From: <name> (<email>)
;            Subject: <subject>
;            Excerpt: <exerpt from the body of the mail> 
;       
;            If there was no excerpt, then it won't echo that line.
;
;            When the script is done checking for unread emails, it will send a signal to
;            the signal event "gmail", with two parameters, being the amount of unread emails,
;            and the email address. This signal event is the first code in the file checkgmail.mrc.
;
;            You can put custom code in there like:
;      
;            //titlebar Unread emails: $1 on account $2
;            //echo -a Found $1 unread emails on account $2
;            ...
;
;
;            To edit the signal event press alt+r, navigate to tab "Remote", click on "View"
;            in the menubar and select "checkgmail.mrc". On the top of the file you will find
;            the following line: on *:signal:gmail:{ which is the signal event that you may edit/delete.
;
;
; Examples:  /checkgmail john.doe@gmail.com
;            /checkgmail john.doe@gmail.com 2
;           //.checkgmail john.doe@gmail.com | .checkgmail jane.doe@gmail.com 4
;
;            If you make the command silent (/.checkgmail <email> [N]), it will not echo
;            the unread mails to the active window.
;
;
; Reqs:      mIRC 6.15 or higher
;
;
; Notes:    * You may wonder why there is no graphical interface for this script. 
;             The reason is simple: if you want a gui to check unread emails, you might
;             as well type //url -na www.gmail.com and check there.
;
;           * The script only checks for unread emails on the first page of your inbox.
;
;           * The code using COM is only used once to retrieve the cookie for an account,
;             it is not executed with subsequent checks on the account.
;
;           * TODO: ability to read emails in mIRC along with a minimalistic GUI
